package org.lee.jfm;

import org.jfree.data.jdbc.JDBCCategoryDataset;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

/**
 * GoldMedalsLondonDao
 *
 * @author dralee
 * @date 2021-12-29 15:47:18
 **/
public class GoldMedalsLondonDao {
    private static final String url = "jdbc:mysql://test-db.xianshuabao.com:3306/demo";
    private static final String user = "root";
    private static final String password = "1234";

    public JDBCCategoryDataset getList() {
        try (Connection connection = DriverManager.getConnection(url, user, password)) {
            JDBCCategoryDataset dataset = new JDBCCategoryDataset(connection);
            dataset.executeQuery("select country,medals from gold_medals_london");
            return dataset;
        } catch (SQLException throwables) {
            throwables.printStackTrace();
        }
        return null;
    }
}
